﻿
Partial Class control
    Inherits System.Web.UI.Page


End Class


'Class clsXML

'    'strFile must be full path to document, ie C:\XML\XMLFile.XML
'    'objDoc is the XML Object
'    Private strFile As String
'    Private objDoc As Object

'    '*********************************************************************
'    ' Initialization/Termination
'    '*********************************************************************

'    'Initialize Class Members
'    Private Sub Class_Initialize()
'        strFile = ""
'    End Sub

'    'Terminate and unload all created objects
'    Private Sub Class_Terminate()
'        objDoc = Nothing
'    End Sub

'    '*********************************************************************
'    ' Properties
'    '*********************************************************************

'    'Set XML File and objDoc
'  Public Property Let File(str)
'    Set objDoc = Server.CreateObject("Microsoft.XMLDOM")
'            objDoc.async = False
'            strFile = str
'            objDoc.Load(strFile)
'  End Property

'            'Get XML File
'  Public Property Get File()
'    File = strFile
'    End Property

'    '*********************************************************************
'    ' Functions
'    '*********************************************************************

'    'Create Blank XML File, set current obj File to newly created file
'    Public Sub createFile(ByVal strPath As String, ByVal strRoot As String)
'        Dim objFSO, objTextFile As Object
'        objFSO = Server.CreateObject("Scripting.FileSystemObject")
'        objTextFile = objFSO.CreateTextFile(strPath, True)
'        objTextFile.WriteLine("<?xml version=""1.0""?>")
'        objTextFile.WriteLine("<" & strRoot & "/>")
'        objTextFile.Close()
'        Me.File = strPath
'        objTextFile = Nothing
'        objFSO = Nothing
'    End Sub

'    'Get XML Field(s) based on XPath input from root node
'    Public Sub getField(ByVal strXPath As String)
'        Dim objNodeList, arrResponse(), i As Object
'        objNodeList = objDoc.documentElement.selectNodes(strXPath)
'        ReDim arrResponse(objNodeList.length)
'        For i = 0 To objNodeList.length - 1
'            arrResponse(i) = objNodeList.item(i).Text
'        Next
'        getField = arrResponse
'    End Sub

'    'Update existing node(s) based on XPath specs
'    Public Sub updateField(ByVal strXPath As String, ByVal strData As String)
'        Dim objField As Object
'        For Each objField In objDoc.documentElement.selectNodes(strXPath)
'            objField.Text = strData
'        Next
'        objDoc.Save(strFile)
'        objField = Nothing
'        updateField = True
'    End Sub

'    'Create node directly under root
'    Public Sub createRootChild(ByVal strNode As String)
'        Dim objChild As Object
'        objChild = objDoc.createNode(1, strNode, "")
'        objDoc.documentElement.appendChild(objChild)
'        objDoc.Save(strFile)
'        objChild = Nothing
'    End Sub

'    'Create a child node under root node with attributes
'    Public Sub createRootNodeWAttr(ByVal strNode As String, ByVal attr As Object, ByVal val As Object)
'        Dim objChild, objAttr As Object
'        objChild = objDoc.createNode(1, strNode, "")
'        If IsArray(attr) And IsArray(val) Then
'            If UBound(attr) - LBound(attr) <> UBound(val) - LBound(val) Then
'                Exit Sub
'            Else
'                Dim i As Object
'                For i = LBound(attr) To UBound(attr)
'                    objAttr = objDoc.createAttribute(attr(i))
'                    objChild.setAttribute(attr(i), val(i))
'                Next
'            End If
'        Else
'            objAttr = objDoc.createAttribute(attr)
'            objChild.setAttribute(attr, val)
'        End If
'        objDoc.documentElement.appendChild(objChild)
'        objDoc.Save(strFile)
'        objChild = Nothing
'    End Sub

'    'Create a child node under the specified XPath Node
'    Public Sub createChildNode(ByVal strXPath As String, ByVal strNode As String)
'        Dim objParent, objChild As Object
'        For Each objParent In objDoc.documentElement.selectNodes(strXPath)
'            objChild = objDoc.createNode(1, strNode, "")
'            objParent.appendChild(objChild)
'        Next
'        objDoc.Save(strFile)
'        objParent = Nothing
'        objChild = Nothing
'    End Sub

'    'Create a child node(s) under the specified XPath Node with attributes
'    Public Sub createChildNodeWAttr(ByVal strXPath As String, ByVal strNode As String, ByVal attr As Object, ByVal val As Object)
'        Dim objParent, objChild, objAttr As Object
'        For Each objParent In objDoc.documentElement.selectNodes(strXPath)
'            objChild = objDoc.createNode(1, strNode, "")
'            If IsArray(attr) And IsArray(val) Then
'                If UBound(attr) - LBound(attr) <> UBound(val) - LBound(val) Then
'                    Exit Sub
'                Else
'                    Dim i As Object
'                    For i = LBound(attr) To UBound(attr)
'                        objAttr = objDoc.createAttribute(attr(i))
'                        objChild.SetAttribute(attr(i), val(i))
'                    Next
'                End If
'            Else
'                objAttr = objDoc.createAttribute(attr)
'                objChild.setAttribute(attr, val)
'            End If
'            objParent.appendChild(objChild)
'        Next
'        objDoc.Save(strFile)
'        objParent = Nothing
'        objChild = Nothing
'    End Sub

'    'Delete the node specified by the XPath
'    Public Sub deleteNode(ByVal strXPath As String)
'        Dim objOld As Object
'        For Each objOld In objDoc.documentElement.selectNodes(strXPath)
'            objDoc.documentElement.removeChild(objOld)
'        Next
'        objDoc.Save(strFile)
'        objOld = Nothing
'    End Sub
'End Class

